﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Micro.Core.Options
{
    /// <summary>
    /// 服务发现
    /// </summary>
    public class ServiceDiscoveryOption
    {
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Enabled { get; set; } = false;

        public string Id => $"{this.Name}_{this.IP}_{this.Port}";

        /// <summary>
        /// 健康检查地址
        /// </summary>
        public string Health { get; set; } = "/health";

        public string Name { get; set; }

        public string Schema { get; set; } = "http";

        /// <summary>
        /// 启动监听的地址
        /// </summary>
        public string IP { get; set; }

        /// <summary>
        /// 监听端口
        /// </summary>
        public int Port { get; set; }


        /// <summary>
        /// 服务启动多久后注册
        /// </summary>
        public int RegistAfterTime { get; set; } = 5;

        /// <summary>
        /// 健康检查时间间隔，或者称为心跳间隔
        /// </summary>
        public int HealthCheckTime { get; set; } = 10;

        /// <summary>
        /// 超时移除
        /// </summary>
        public int HealthCheckTimeOut { get; set; } = 60;

        /// <summary>
        /// Consul Client Url
        /// </summary>
        public string ConsulUrl { get; set; }
    }
}
